function varerr(time,y,~,~,~,Y)

load('orthbase');
load('mcpart');

exactvar=1/4*mcpart+3/2*time'+1/4*(exp(-2*time)-1)'-(3/4*time+1/8*(exp(-2*time)-1)).^2';
%exactvar=1/4*mcpart+1/2*time.^2'-1/16*time.^4';
%exactvar=4*time';
exactvar=1/2*(exp(2*time)-1)';
hold on
plot(time,exactvar);
tmp=zeros(size(y(:,1)));
for ii=2:size(Y,2)
    %tmp=tmp+Y(:,ii).*Y(:,ii);
    tmp=tmp+Y(:,ii);
end
plot(time,tmp,'r-');
title('Variance')
legend('exact var','wce var');
